<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/country.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="location = '<?php echo $insert; ?>'" class="button"><?php echo $button_insert; ?></a></div>
    </div>
    <div class="content">
      <form action="" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr>
              <td class="left"><?php echo $column_country_id; ?></td>
              <td class="left"><?php echo $column_country; ?></td>
              <td class="left"><?php echo $column_name; ?></td>
              <td class="left"><?php echo $column_display_name; ?></td>
              <td class="left"><?php echo $column_code; ?></td>
              <td class="left"><?php echo $column_postcode; ?></td>
              <td class="left"><?php echo $column_time_difference; ?></td>
              <td class="left"><?php echo $column_status; ?></td>
              <td class="right"><?php echo $column_action; ?></td>
            </tr>
          </thead>
          <tbody>
            <tr class="filter">
              <td class="left"><input type="text" name="filter_country_id" value="<?php echo $filter_country_id; ?>" size="11"/></td>
              <td class="left"></td>
              <td class="left"></td>
              <td class="left"><input type="text" name="filter_display_name" value="<?php echo $filter_display_name; ?>" /></td>
              <td class="left"><input type="text" name="filter_code" value="<?php echo $filter_code; ?>" size="11"/></td>
              <td class="left"><input type="text" name="filter_postcode" value="<?php echo $filter_postcode; ?>" size="11"/></td>
              <td class="left"></td>
              <td class="left">
                <input type="radio" name="filter_status" value="-1" <?php if ($filter_status == -1){ echo 'checked="checked"';} ?> /><?php echo $text_all; ?>
              	<input type="radio" name="filter_status" value="0" <?php if ($filter_status == 0){ echo 'checked="checked"';} ?> /><?php echo $text_disabled; ?>
                <input type="radio" name="filter_status" value="1" <?php if ($filter_status == 1){ echo 'checked="checked"';} ?> /><?php echo $text_enabled; ?>
              </td>
              <td align="right"><a onclick="filter();" class="button"><?php echo $button_filter; ?></a></td>
            </tr>
            <?php if ($country_zones) { ?>
            <?php foreach ($country_zones as $country_zone) { ?>
            <tr>
              <td class="left"><?php echo $country_zone['country_id']; ?></td>
              <td class="left"><?php echo $country_zone['country_display_name']; ?></td>
              <td class="left"><?php echo $country_zone['name']; ?></td>
              <td class="left"><?php echo $country_zone['display_name']; ?></td>
              <td class="left"><?php echo $country_zone['code']; ?></td>
              <td class="left"><?php echo $country_zone['postcode']; ?></td>
              <td class="left"><?php echo $country_zone['time_difference']; ?></td>
              <td class="left">
              	<?php if ($country_zone['status'] == '0') { echo $text_disabled;} else { echo $text_enabled; } ?>
              </td>
              <td class="right"><?php foreach ($country_zone['action'] as $action) { ?>
                [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                <?php } ?></td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="9"><?php echo $text_no_results; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
      <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function filter() {
	url = 'index.php?route=localisation/country_zone&token=<?php echo $token; ?>';
	var filter_country_id = $('input[name=\'filter_country_id\']').attr('value');
	if (filter_country_id) {
		url += '&filter_country_id=' + encodeURIComponent(filter_country_id);
	}
	var filter_display_name = $('input[name=\'filter_display_name\']').attr('value');
	if (filter_display_name) {
		url += '&filter_display_name=' + encodeURIComponent(filter_display_name);
	}
	var filter_code = $('input[name=\'filter_code\']').attr('value');
	if (filter_code) {
		url += '&filter_code=' + encodeURIComponent(filter_code);
	}
	var filter_postcode = $('input[name=\'filter_postcode\']').attr('value');
	if (filter_postcode) {
		url += '&filter_postcode=' + encodeURIComponent(filter_postcode);
	}
	var filter_status = $('input[name=\'filter_status\']:checked').attr('value');
	if (filter_status != '-1') {
		url += '&filter_status=' + encodeURIComponent(filter_status);
	}	
	location = url;
}
$('#form input').keydown(function(e) {
	if (e.keyCode == 13) {
		filter();
	}
});
//--></script>
<?php echo $footer; ?>